package org.deschutter.hibernate;

import javax.persistence.*;
import java.util.Collection;

/**
 * User: Berten De Schutter
 * Date: 01-Oct-2009
 * Time: 13:38:10
 */
@Entity
@Table(catalog = "scimitar", name = "channel_types")
public class ChannelTypes {
    private byte id;

    @Id
    @Column(name = "ID")
    public byte getId() {
        return id;
    }

    public void setId(byte id) {
        this.id = id;
    }

    private String name;

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ChannelTypes that = (ChannelTypes) o;

        if (id != that.id) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) id;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }

    private Collection<Channels> channelsesById;

    @OneToMany(mappedBy = "channelTypesByChannelType")
    public Collection<Channels> getChannelsesById() {
        return channelsesById;
    }

    public void setChannelsesById(Collection<Channels> channelsesById) {
        this.channelsesById = channelsesById;
    }
}
